﻿using CMWVS.Core.Mono;

namespace CMWVS.Core.Commands
{
    public class CleanCommand : RelayCommand<CleanCommandParameters, CleanCommandResult>
    {
        #region Constructor

        private CleanCommand()
        {
        }

        internal CleanCommand(Resolver resolver)
        {
            m_Compiler = new MonoCompiler(resolver);
            this.SetCommands();
        }

        #endregion Constructor

        private MonoCompiler m_Compiler;

        private void SetCommands()
        {
            base.m_CanExecute = () =>
            {
                return m_Compiler.CanExecute();
            };
            base.m_Commmand = (compileParameter) =>
            {
                m_Compiler.Execute(new MonoCompilerParams(compileParameter.SLN, compileParameter.BuildConfiguration, compileParameter.Platform, compileParameter.Listener, new Clean()));
                return new CleanCommandResult();
            };
        }
    }
}